package com.my.assembly.handler;

import android.app.Activity;

import com.my.assembly.bridge.BridgeHandler;
import com.my.assembly.bridge.CallBackFunction;


/**
 * <pre>
 *     author : wxq
 *     e-mail :
 *     time   : 2018/11/27
 *     desc   : 调用原生返回
 *     version: 1.0
 * </pre>
 */
public class ClosePageHandler implements BridgeHandler {

    private Activity mActivity;

    public ClosePageHandler(Activity activity) {
        this.mActivity = activity;
    }

    @Override
    public void handler(String data, CallBackFunction function) {
        if (mActivity != null && !mActivity.isFinishing()) {
            mActivity.finish();
        }
    }
}
